package demo1;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 苏李涛
 * Date: 2024-10-11
 * Time: 21:31
 */

public class Demo9 {

    public static void main(String[] args) throws InterruptedException {

        Thread t = new Thread(() -> {
            while (true) {

                try {
                    Thread.sleep(1000);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }
        });

        System.out.println(t.getState());//NEW状态：还未开始工作

        t.start();
        t.join(1000 * 10);
        System.out.println(t.getState());//TIMED_WAITING：阻塞状态

    }
}
